﻿<Autocomplete TItem="Country"
                TValue="string"
                Data="@Countries"
                TextField="@(( item ) => item.Name)"
                ValueField="@(( item ) => item.Iso)"
              @bind-SelectedValues="SelectedValues"
              @bind-SelectedTexts="SelectedTexts"
                Placeholder="Search..."
                FreeTyping
                SelectionMode="AutocompleteSelectionMode.Checkbox">
    <NotFoundContent> Sorry... @context was not found! :( </NotFoundContent>
</Autocomplete>

@code{
    [Inject]
    public CountryData CountryData { get; set; }
    public IEnumerable<Country> Countries;

    protected override async Task OnInitializedAsync()
    {
        Countries = await CountryData.GetDataAsync();
        await base.OnInitializedAsync();
    }

    [Parameter]
    public List<string> SelectedValues { get; set; }

    [Parameter]
    public List<string> SelectedTexts { get; set; }
}